<?php

namespace App\Listeners\Plane\PlaneOrder;

use App\Events\Plane\PlaneOrder\PlaneOrderTicketedEvent;
use App\Models\Plane\PlaneOrders\Repositories\Interfaces\PlaneOrderRepositoryInterface;
use Exception;

class PlaneOrderTicketedListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param PlaneOrderTicketedEvent $event
     * @return void
     * @throws Exception
     */
    public function handle(PlaneOrderTicketedEvent $event)
    {
        $order_info     = $event->order;
        $passengers     = $event->passengers;
        $planeOrderRepo = app(PlaneOrderRepositoryInterface::class);
        $planeOrderRepo->ticketed($order_info, [
            'passengers' => $passengers,
        ]);
    }
}
